<?php
	//连接数据库
	include 'conn.php';
	
	//获取参数id
	$id = $_GET['id'];
	$stuinfo['name'] = $_POST['name'];
	$stuinfo['sex'] = $_POST['sex'];
	$stuinfo['age'] = $_POST['age'];
	$stuinfo['phone'] = $_POST['phone'];
	
	
	//SQL语句   UPDATE table_name SET field1=new-value1, field2=new-value2
	$sql = 'update stuinfo set sex="'.$stuinfo['sex'].'",age='.$stuinfo['age'].',phone_number="'.$stuinfo['phone'].'" where name ="'.$stuinfo['name'].'"';
	//$sql = update stuinfo set sex=$stuinfo['sex'],age=$stuinfo['age'],phone_number=$stuinfo['phone'] where id=$id;
	
	//$sql = update stuinfo set sex=$sex,age=$age,phone_number=$phone where id=$id;
	//$sql = "UPDATE stuinfo SET sex='$sex',age='$age',subject='$subject',mark='$mark' WHERE id=$id";
	//执行sql语句
	$result = mysqli_query($link,$sql);
	if(!$result){
		echo '0'; //执行失败
		die();
	}else {
		echo '1'; //执行成功
	}
	

?>